import React from 'react'
import { useSelector } from 'react-redux';
import { Navigate } from 'react-router-dom';

const NeedAuth =(props) => {

  const res = useSelector( state => {
    return state.login
  });

  return res.isLogged ? props.children : <Navigate to={'/'} replace/>
    
  
}
export default NeedAuth;
